//
//  GramTableViewCell.m
//  Menu
//
//  Created by YouLu on 15/7/4.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "GramTableViewCell.h"

@implementation GramTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{

    self.picImage = [[UIImageView alloc] initWithFrame:CGRectMake(20*WIDTH, 0, 44, 44)];

    [self.contentView addSubview:self.picImage];
    [_picImage release];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(80*WIDTH, 0, 80*WIDTH, 44)];
    self.nameLabel.numberOfLines = 0;
    [self.contentView addSubview:self.nameLabel];
    [_nameLabel release];
    
    self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(170*WIDTH, 0, 185*WIDTH, 44)];
    self.contentLabel.numberOfLines = 0;
    [self.contentView addSubview:self.contentLabel];
    [_contentLabel release];
    
}
-(void)setFittingModel:(FittingModel *)fittingModel
{
    if (_fittingModel != fittingModel) {
        [_fittingModel release];
        _fittingModel = [fittingModel retain];
    }
    [self.picImage sd_setImageWithURL:[NSURL URLWithString:self.fittingModel.imageName]];
    self.nameLabel.text = self.fittingModel.materialName;
    self.contentLabel.text = self.fittingModel.contentDescription;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
